<?php
 session_start();
 if ( intval($_SESSION['uid']) < 1 ){
     
     header("Location: user_login.php");
     die("未登录，请先登录 <a href='user_login.php'>用户登录</a> ");
     //die("未登录，请先登录<script> location = 'user_login.php' </script>");
 }
    $resume_id = intval($_GET['id']);
    if($resume_id < 1 ) die("错误的简历ID");
    

    $dbms='mysql';     //数据库类型
    $host='localhost'; //数据库主机名
    $dbName='fcoucv';    //使用的数据库
    $user='root';      //数据库连接用户名
    $pass='40qGYxok';          //对应的密码
    $dsn="$dbms:host=$host;dbname=$dbName";

    try {
        $dbh = new PDO($dsn, $user, $pass); //初始化一个PDO对象
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //设置错误模式
        
        //数据库操作
        $sql = "SELECT * FROM `resume` WHERE id = ? Limit 1";
        $result = $dbh->prepare($sql);
        $result->execute([ $resume_id]);

        //$resume_list = $result->fetchall();
        $result_list = $result->fetch();
        //print_r($result_list);
        

    } catch (PDOException $e) {
        die ("Error!: " . $e->getMessage() . "<br/>");
    }

    include "lib/Parsedown.php";
    $Parsedown = new Parsedown();
    
?>
<html>
<head>
    <meta charset="utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />  
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简历展示</title>
    <link rel="stylesheet" type="text/css" media="screen" href="main.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="list.css"/> 
	<script src=http://lib.sinaapp.com/js/jquery/3.1.0/jquery-3.1.0.min.js></script> 
	<script src="send_form.js"></script>
</head>
<body>
    <?php include 'header.php' ?>

	<div class="container_resume">
        
        
        <form action="resume_list.php" method="post">
            <div  class='form_info'></div>
        
            <p><?php print_r( $result_list["title"] )?></p>

            <?= $Parsedown->text( $result_list["content"]) ?> 
            
            <p><input type="submit" value="返回"  class="button_zhuce"></p>
        </form>
	</div>
</body>
</html>